/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package RuleInterence;

import Common.Constant;
import DataSource.Data;

/**
 *
 * @author Tuan
 */
public abstract class HealthRuleAbs implements Rule{
    protected int minSBP;
    protected int maxSBP;
    protected int minDBP;
    protected int maxDBP;
    protected int minHeartBeat;
    protected int maxHeartBeat;
    protected int minTemp;
    protected int maxTemp;
    protected String symptom;
    protected DiagnosticResult result;
    
    public HealthRuleAbs(DataSource.DataEntry dataEntry){
        this.minSBP = dataEntry.getMinSBP();
        this.maxSBP = dataEntry.getMaxSBP();
        this.minDBP = dataEntry.getMinDBP();
        this.maxDBP = dataEntry.getMaxDBP();
        this.minHeartBeat = dataEntry.getMinHeartBeat();
        this.maxHeartBeat = dataEntry.getMaxHeartBeat();
        this.minTemp = Constant.MIN_TEMP;
        this.maxTemp = Constant.MAX_TEMP;
    }

    public DiagnosticResult checkSymptom(Data data) {
        DiagnosticResult result = new DiagnosticResult(symptom, data);
        return data.getSystolic() >= this.minSBP && data.getSystolic() <= this.maxSBP
                && data.getDiastolic() >= this.minDBP && data.getDiastolic() <= this.maxDBP
                && data.getHeartBeat() > Constant.HIGH_HB
                ? result : null;
    }
    
    
}
